package lec12;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JList;

public class JListDemo extends JFrame implements ActionListener {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JList<String> list = new JList<>();
	JButton btn = new JButton("test");

	public JListDemo() {
		btn.addActionListener(this);
		this.setLayout(new FlowLayout());
		this.add(btn);
		this.add(list);
		list.setVisible(true);
		setSize(400, 300);
		setVisible(true);
	}

	public static void main(String[] args) {
		new JListDemo();
	}

	int n = 0;

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == btn) {
			// list.setListData();
			repaint();
		}

	}

}
